Hibernate inactive terminal tabs to bound long-session resource use - #709
Merged
sbertix merged 7 commits intoJul 22, 2026
Merged
Conversation
Hidden tabs release their Ghostty surfaces after five minutes; the zmx sessions survive and selecting the tab rebuilds the layout with the original surface UUIDs so sessions reattach in place. Agents keep running through hibernation, and dormant sessions keep routing OSC notifications, agent presence, and titles through the passive watchers.
sbertix
enabled auto-merge (squash)
July 21, 2026 22:05
…ate-inactive-terminal-surfaces-to # Conflicts: # supacode/Features/Terminal/BusinessLogic/WorktreeTerminalManager.swift # supacode/Features/Terminal/Models/WorktreeTerminalState.swift # supacodeTests/SettingsFeatureTests.swift
Jumping to a hibernated tab's notification wakes it, selects its worktree, and lands keyboard focus in the terminal. A partial wake now logs its own error and falls back to whatever the tab rebuilt instead of stranding a woken tab with nothing focused. Closing a hibernated tab always confirms: it has no live surface to ask, and waking one to read its prompt state races the zmx replay. The reason rides on the pending confirmation so the copy names what was actually found, and a tab holding a pending alert no longer hibernates underneath it.
…ate-inactive-terminal-surfaces-to # Conflicts: # SupacodeSettingsShared/Models/GlobalSettings.swift # supacodeTests/SettingsFilePersistenceTests.swift
sbertix
deleted the
sbertix/gh-680-hibernate-inactive-terminal-surfaces-to
branch
July 22, 2026 08:16
Closed
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #680
Summary
Hidden terminal tabs (background tabs of the selected worktree and all tabs of
deselected worktrees) now release their Ghostty surfaces after five minutes of
being hidden. The zmx sessions survive untouched, and selecting the tab
rebuilds the layout with the original surface UUIDs so every pane reattaches
in place with its screen, scrollback, and running processes intact. This
bounds the memory, CPU, and process count of long-lived sessions instead of
letting every open tab hold a live terminal forever.
session, and a passive per-session watcher keeps OSC signals lossless while
dormant, so notifications (OSC 9), agent presence (OSC 3008), and titles
still arrive and unseen-notification counters survive the dark period.
zzzindicator inthe tab bar and sidebar.
single default source of truth so pre-feature settings files decode to on.
Known tradeoffs: the handoff between a live surface and its watcher has a
millisecond-scale window at hibernate and wake (a signal can be lost or, far
more rarely, a 3008 notification duplicated), waking a session whose process
died spawns a fresh shell, and turning the toggle off does not force-wake
already-dormant tabs; they wake on selection.
Type of change
ready)How was this tested?
Unit coverage for the hibernation state machine (eligibility, teardown
bookkeeping, wake paths, dormant OSC ingestion, watcher lifecycle, flag
gating, and persistence round-trips) plus watcher tests against a fake socket
server. Verified live by hibernating and waking real agent sessions.
make checkpasses (format + lint)make testpassesChecklist
Closes #above.ready.